/**
 * Created by LIUXIANGYU on 2017/3/29.
 */
package job;

import azkaban.utils.Props;
import org.apache.log4j.Logger;

import java.util.concurrent.TimeUnit;

public class JavaJob {

    private static final Logger logger = Logger.getLogger(JavaJob.class);

    private static int fileRows = 0;
    private static int fileLine = 0;
    public static String day = null;

    public JavaJob(String name, Props props) throws Exception {
        this.fileRows = props.getInt("file.rows");
        this.fileLine = props.getInt("file.line");
        day = props.getString("azkaban.flow.start.day");
    }

    public void run() throws Exception {
        logger.info(" ### this is java job type with runtime params###");
        logger.info("Today is " + day);
        logger.info("fileLine value is ==> " + fileLine);
        logger.info("fileRows value is ==> " + fileRows);
        TimeUnit.MILLISECONDS.sleep(5000);
        throw new RuntimeException("on purpose exception");

    }

    public void cancel() throws Exception {
        logger.info("job is being canceled");
    }


}